package apiwork.bean;

import java.lang.reflect.Method;

public class ICtrlBean {
	private String objtype;

	private String opttype;

	public String getObjtype() {
		return objtype;
	}

	public void setObjtype(String objtype) {
		this.objtype = objtype;
	}

	public String getOpttype() {
		return opttype;
	}

	public void setOpttype(String opttype) {
		this.opttype = opttype;
	}

	private String fillField = "";

	public String toString() {
		String retStr = "{ Class:";
		Class c = this.getClass();
		retStr += c.getName();
		Method[] methods = c.getMethods();
		for (Method method : methods) {
			String methodName = method.getName();
			if (methodName.equals("getClass")) {

			} else if (methodName.startsWith("get")) {
				retStr += " , " + methodName.substring(3, 4).toLowerCase()
						+ methodName.substring(4) + ":";
				try {
					retStr += method.invoke(this, new Object[0]);
				} catch (Exception e) {
				}
			} else if (methodName.startsWith("is")) {
				retStr += " , " + methodName.substring(2, 3).toLowerCase()
						+ methodName.substring(3) + ":";
				try {
					retStr += method.invoke(this, new Object[0]);
				} catch (Exception e) {
				}
			}
		}
		retStr += " }";
		return retStr;
	}

	public String getFillField() {
		return fillField;
	}

	public void setFillField(String fillField) {
		if (this.fillField.trim().equals(""))
			this.fillField = fillField;
		else
			this.fillField += " , " + fillField;
	}
}
